﻿using System;
using System.Collections.Generic;
using Microsoft.EntityFrameworkCore;

namespace 网络权限验证_通用版;

public partial class IpinfoContext : DbContext
{
    public IpinfoContext()
    {
    }

    public IpinfoContext(DbContextOptions<IpinfoContext> options)
        : base(options)
    {
    }

    public virtual DbSet<TIp> TIps { get; set; }

    protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
#warning To protect potentially sensitive information in your connection string, you should move it out of source code. You can avoid scaffolding the connection string by using the Name= syntax to read it from configuration - see https://go.microsoft.com/fwlink/?linkid=2131148. For more guidance on storing connection strings, see http://go.microsoft.com/fwlink/?LinkId=723263.
        => optionsBuilder.UseSqlServer("");

    protected override void OnModelCreating(ModelBuilder modelBuilder)
    {
        modelBuilder.Entity<TIp>(entity =>
        {
            entity.HasKey(e => e.Id)
                .HasName("HKInfo_pk")
                .IsClustered(false);

            entity.ToTable("T_IP");

            entity.Property(e => e.AppName)
                .HasMaxLength(200)
                .IsUnicode(false);
            entity.Property(e => e.City)
                .HasMaxLength(500)
                .IsUnicode(false);
            entity.Property(e => e.Country)
                .HasMaxLength(500)
                .IsUnicode(false);
            entity.Property(e => e.Datetime).HasColumnType("datetime");
            entity.Property(e => e.District)
                .HasMaxLength(500)
                .IsUnicode(false);
            entity.Property(e => e.Ip)
                .HasMaxLength(100)
                .IsUnicode(false)
                .HasColumnName("IP");
            entity.Property(e => e.Isp)
                .HasMaxLength(500)
                .IsUnicode(false);
            entity.Property(e => e.Owner)
                .HasMaxLength(500)
                .IsUnicode(false);
            entity.Property(e => e.Prov)
                .HasMaxLength(500)
                .IsUnicode(false);
            entity.Property(e => e.UserName)
                .HasMaxLength(200)
                .IsUnicode(false);
        });

        OnModelCreatingPartial(modelBuilder);
    }

    partial void OnModelCreatingPartial(ModelBuilder modelBuilder);
}
